﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    class ProxyChucNang
    {
        TaiKhoan User;
        ProxyQuanLi Facade;

        public ProxyChucNang(TaiKhoan tk, ProxyQuanLi facade)
        {
            User = tk;
            Facade = facade;
        }
        #region Quan ly sinh vien
        public void AddSinhVien(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLSV.Add(ob);
        }

        public void DeleteSinhVien(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLSV.Delete(ob);
        }

        public void UpdateSinhVien(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLSV.Update(ob);
        }

        public List<BaseData> FindAllSinhVien(Predicate<BaseData> Predicate)
        {
            return Facade.QLSV.FindAll(Predicate);
        }

        public BaseData FindSinhVien(Func<BaseData, bool> predicate)
        {
            return Facade.QLSV.Find(predicate);
        }
        #endregion

        #region Quan ly lop hoc
        public void AddLopHoc(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLyLop.Add(ob);
        }

        public void DeleteLopHoc(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLyLop.Delete(ob);
        }

        public void UpdateLopHoc(BaseData ob)
        {
            if (User.PhanQuyen == 1)
                Facade.QLyLop.Update(ob);
        }

        public List<BaseData> FindAllLopHoc(Predicate<BaseData> Predicate)
        {
            return Facade.QLyLop.FindAll(Predicate);
        }

        public BaseData FindLopHoc(Func<BaseData, bool> predicate)
        {
            return Facade.QLyLop.Find(predicate);
        }
        #endregion

        
    }
}
